local userKey = KEYS[1]
local countKey = KEYS[2]
local userId = ARGV[1]

if redis.call('SADD', userKey, userId) == 1 then
    redis.call('INCR', countKey)
    return 1
else
    return 0
end